package com.hrt.datasender.web.bdplccontrol;

import com.btcode.db.result.Row;
import com.btcode.web.core.annotation.RequestMapping;
import com.btcode.web.core.controller.Controller;
import com.hrt.common.web.RequestUnit;

import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;

/**
 * PLC控制
 */
@RequestMapping(path = "bd-plc-control")
public class BdPlcControlController extends Controller {

    @RequestMapping(path = "get-device-info")
    public void getList(ServletRequest arg0, ServletResponse arg1) throws IOException {
        List<Row> result = BdPlcControlService.getInstance().getDeviceInfo();
        success(result);
    }

    @RequestMapping(path = "get-device-detail-info")
    public void getDeviceDetailInfo(ServletRequest arg0, ServletResponse arg1) throws IOException {
        HashMap<String,String> parms = RequestUnit.getHashMapParmS();
        List<Row> result = BdPlcControlService.getInstance().getDeviceDetailInfo(parms);
        success(result);
    }

    @RequestMapping(path = "get-system-info")
    public void getSystemInfo(ServletRequest arg0, ServletResponse arg1) throws IOException {
        List<Row> result = BdPlcControlService.getInstance().getSystemInfo();
        success(result);
    }

    @RequestMapping(path = "get-system-detail-info")
    public void getSystemDetailInfo(ServletRequest arg0, ServletResponse arg1) throws IOException {
        List<Row> result = BdPlcControlService.getInstance().getSystemDetailInfo();
        success(result);
    }

    @RequestMapping(path = "get-plc-alarm")
    public void getPlcAlarm(ServletRequest arg0, ServletResponse arg1) throws IOException {
        HashMap<String,String> parms = RequestUnit.getHashMapParmS();
        List<Row> result = BdPlcControlService.getInstance().getPlcAlarm(parms);
        success(result);
    }

    @RequestMapping(path = "get-param-by-device")
    public void getParamByDevice(ServletRequest arg0, ServletResponse arg1) throws IOException {
        HashMap<String,String> parms = RequestUnit.getHashMapParmS();
        List<Row> result = BdPlcControlService.getInstance().getParamByDevice(parms);
        success(result);
    }

}
